package com.arvato.common.util;


import org.json.JSONException;
import org.json.JSONObject;
import org.json.XML;
 


public class Dom4jUtils {

    /**
     * JSONObject
     * @param xml
     * @return
     */
    public static JSONObject xml2jsonObjesct(String xml) throws JSONException {
    	xml.replace("?xml version=\"1.0\" encoding=\"utf-8\"?", " ");
        JSONObject xmlJSONObj = XML.toJSONObject(xml);
       
        return xmlJSONObj;
    }
    
    public static void main(String[] args) throws JSONException {
		String xml="﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" + 
				"<Result xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" + 
				"  <ErrorCode />\r\n" + 
				"  <Message />\r\n" + 
				"  <CurrentPointInfo>\r\n" + 
				"    <OwnerId>10</OwnerId>\r\n" + 
				"    <MemberNo>M1000450893</MemberNo>\r\n" + 
				"    <Point>41997</Point>\r\n" + 
				"    <Status>10</Status>\r\n" + 
				"  </CurrentPointInfo>\r\n" + 
				"</Result>";
		System.out.println(xml2jsonObjesct(xml).toString());
	}
	
}
